package edu.hgnu.provider;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import edu.hgnu.utils.RabbitMQUtils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class Provider {
    public static void main(String[] args) throws IOException {

        final String exchangeName="exchange_1";
        final String routingKey = "user.info.name";

        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(exchangeName,"topic");

        channel.basicPublish(exchangeName,routingKey,null,("这是基于direct模型发布的基于route key:"+routingKey+"发送的消息").getBytes(StandardCharsets.UTF_8));
        RabbitMQUtils.closeConnAndChanel(connection,channel);

    }
}
